import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'


// 首页
import HomeView from '@/views/home/index.vue'
import Video from '@/views/video/index.vue'
import Message from '@/views/messages/index.vue'
import My from '@/views/my/index.vue'

import FooterCom from '@/components/FooterCom.vue'
import UserAgreement from '@/views/UserAgreement.vue'
import RecentView from '@/views/my/recent.vue'
import MyVideo from '@/views/my/MyVideo.vue'
import MyArticle from '@/views/my/MyArticle.vue'

const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            redirect: '/userAgreement'
        },
        {
            path: '/userAgreement',
            name: 'userAgreement',
            component: UserAgreement
        },
        {
            path: '/my',
            name: 'my',
            components: {
                default: My,
                FooterCom
            },
            children: [{
                path: 'recent',
                name: 'recent',
                component: RecentView
            }, {
                path: 'myVideo',
                name: 'myVideo',
                component: MyVideo
            }, {
                path: 'myArticle',
                name: 'myArticle',
                component: MyArticle
            }]
        },
        {
            path: '/home',
            name: 'home',
            components: {
                default: HomeView,
                FooterCom
            },
        },
        {
            path: '/video',
            name: 'video',
            components: {
                default: Video,
                FooterCom
            },
        },
        {
            path: '/messages',
            name: 'messages',
            components: {
                default: Message,
                FooterCom
            },

        }, {
            path: '/detail',
            name: 'detail',
            component: () => import('../views/messages/detail.vue')
        }, {
            path: '/set',
            name: 'set',
            component: () => import('../views/messages/set.vue')
        },
        {
            path: '/bottomLogin',
            name: 'bottomLogin',
            component: () => import('@/views/BottomLogin.vue')
        }
    ],
})

export default router
